import request from '@/utils/request/request';

// 人员物料维护分页
export function getQueryPage(params) {
  return request.get('/api/procurement/infra/user-material-config/page', {
    params,
  });
}
// 根据品类查物料
export function getAttributeQueryPage(params) {
  return request.get('/api/procurement/infra/procurement-attribute/page', {
    params,
  });
}
// 根据供应商查物料
export function getSupplierQueryPage(params) {
  return request.get('/api/procurement/infra/supplier-info/page', {
    params,
  });
}
// 按物料添加
export function saveByMaterial(data: any) {
  return request.post(
    '/api/procurement/infra/user-material-config/saveByMaterial',
    data
  );
}
// 按品类添加
export function saveByCategory(data: any) {
  return request.post(
    '/api/procurement/infra/user-material-config/saveByCategory',
    data
  );
}
// 按供应商添加
export function saveBySupplier(data: any) {
  return request.post(
    '/api/procurement/infra/user-material-config/saveBySupplier',
    data
  );
}
// 删除
export function deleteConfig(id: string) {
  return request.delete(`/api/procurement/infra/user-material-config/${id}`);
}
// 变更规则
export function changRule(data: any) {
  return request.put(
    '/api/procurement/infra/user-material-config/changRule',
    data
  );
}
// 批量复制给指定人
export function saveByUser(data: any) {
  return request.post(
    '/api/procurement/infra/user-material-config/saveByUser',
    data
  );
}
// 人员物料维护下载模版
export function downloadFile() {
  return request.post(
    '/api/procurement/infra/user-material-config/download/template'
  );
}
// 员物料维护数据导入
export function importExcelToData(data: FormData) {
  return request.post(
    '/api/procurement/infra/user-material-config/import',
    data,
    {
      headers: {
        'Content-Type': 'application/form-data',
      },
    }
  );
}
